﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;
using Microhard.Permission.Validator;

//程琳 2012-9-17
namespace Microhard.Permission.Models
{
    /// <summary>
    /// 系统资源
    /// </summary>
    [FluentValidation.Attributes.Validator(typeof(ResouceValidator))]
    public class Resouce
    {
        /// ID
        /// </summary>
        public Guid ResourceID { set; get; }

        /// <summary>
        /// 资源类型ID
        /// </summary>
        public Guid ResourceTypeID { set; get; }


        /// <summary>
        /// 父资源ID
        /// </summary>
        public Guid? ParentResourceID { set; get; }
        /// <summary>
        /// 父资源名称
        /// </summary>
        public string ParentResouceName { set; get; }

        /// <summary>
        /// 资源唯一名称
        /// </summary>
        public string KeyName { set; get; }

        /// <summary>
        /// 资源名称
        /// </summary>
        public string Name { set; get; }


        public bool Status { get; set; }

        /// <summary>
        /// 资源拥有的操作
        /// </summary>
        public List<Operation> OperationList { get; set; }

        /// <summary>
        /// 资源备注
        /// </summary>
        public string Description { get; set; }

        /// <summary>
        /// 子资源
        /// </summary>
        public List<Resouce> SubResources { set; get; }
        /// <summary>
        /// 资源类型
        /// </summary>
        public ResouceType ResourceType { get; set; }

        public string ResourceTypeName { set; get; }

        public bool IsSub { set; get; }

        /// <summary>
        /// 适用组
        /// </summary>
        public Guid AllowGroupID { set; get; }
        /// <summary>
        /// 组名称
        /// </summary>
        public string AllowGroupName { set; get; }

        /// <summary>
        /// 是否在系统菜单上显示
        /// </summary>
        public bool ShowOnMenu { set; get; }
        public string ShowOnMenuTxt
        {
            get
            {
                return ShowOnMenu == true ? "是" : "否";
            }
        }
    }
}
